package reflect;

import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;

public class ReflectDemo3 {
    public static void main(String[] args) throws ClassNotFoundException, NoSuchMethodException, InvocationTargetException, InstantiationException, IllegalAccessException {
        Person p=new Person("李四",22,"广东");
        System.out.println(p);

        Class cls=Class.forName("reflect.Person");
        Constructor c = cls.getConstructor(String.class, int.class,String.class);
        Object obj=c.newInstance("王五",33,"广西");
        System.out.println(obj);
    }
}
